/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package frm.billingAndPaymentProcessing.managedbean;

import frm.billingAndPaymentProcessing.entity.VoucherEntity;
import frm.billingAndPaymentProcessing.session.VoucherSessionBean;
import java.io.IOException;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author xhx
 */
@ManagedBean
@ViewScoped
public class ViewAllVouchersManagedBean {
private VoucherEntity voucherEntity;

@EJB
VoucherSessionBean voucherSessionBean;
    /** Creates a new instance of ViewAllVouchersManagedBean */
    public ViewAllVouchersManagedBean() {
    }
   
    
    public List<VoucherEntity> getVoucherList(){
//        System.out.print("insideTest...." + voucherSessionBean.getAllVouchers().size());
        return voucherSessionBean.getAllVouchers();   
    }
    public void viewVoucher(VoucherEntity selectVoucherEntity) throws IOException{
        voucherEntity = selectVoucherEntity;
       FacesContext.getCurrentInstance().getExternalContext().getFlash().put("voucher", voucherEntity);
       FacesContext.getCurrentInstance().getExternalContext().redirect("displayVoucher.xhtml");
    }
    public VoucherEntity getVoucherEntity() {
        return voucherEntity;
    }

    public void setVoucherEntity(VoucherEntity voucherEntity) {
        this.voucherEntity = voucherEntity;
    }
}
